<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title> TODO supply a title</title>
        <h:outputStylesheet name="css/jsfcrud.css"/>
    </h:head>
    <h:body> 
        <h:form>
        <p:dataTable var="query" value="#{queriesManagedBean.queryList}" rowKey="#{query.id}"
                     paginator="true" rows="10"
                     selection="#{queriesManagedBean.query}">
            <f:facet name="header">  
                Click "Select" button after selecting a row to execute this query exchange  
            </f:facet>  
            <p:column selectionMode="single" style="width:2%" /> 
            <p:column headerText="Amount">  
                #{query.amount}  
            </p:column>  

            <p:column headerText="Currency from">  
                #{query.currencyFrom.shortName}  
            </p:column>  

            <p:column headerText="Currency to" >  
                #{query.currencyTo.shortName}   
            </p:column>  

            <p:column headerText="Rate from">  
                #{query.rateFrom}  
            </p:column>  

            <p:column headerText="Rate to">  
                #{query.rateTo}  
            </p:column>  

            <p:column headerText="Finish Date">  
                #{query.finishDate}  
            </p:column>  

            <f:facet name="footer">  
                <p:commandButton value="Exchange" 
                                 action="#{queriesManagedBean.doExchangeQuery()}"/>  
            </f:facet>  
        </p:dataTable>  
    </h:form>
    </h:body>
</html>
